﻿@model RegisterModel
@{
    Layout = "~/Views/Shared/_LayoutPartial.cshtml";
    ViewBag.ImageUrl = "~/content/images/add_user.png";
    ViewBag.Title = Html.Global("RES_CREATENEWACCOUNT");
    var web = WebSiteContext.Current.RootWeb;
    if (web.MasterTools.EnableReCaptcha)
    {
        ReCaptcha.PrivateKey = web.MasterTools.ReCaptchaPrivateKey;
        ReCaptcha.PublicKey = web.MasterTools.ReCaptchaPublicKey;
    }
}
@{Ajax.Dna().WidgetZone("Top zone", "zone1").Render();}
@using (Html.BeginForm())
{
    if (Request.QueryString["openid"]!=null)
    {
        <input name="OpenID" value="@Request.QueryString["openid"]" type="hidden" />
    }
    
    @Html.ValidationSummary() 
    <table style="width: 100%;">
        <tr>
            <td style="width: 450px; padding: 8px;">
                <table cellpadding="5px;" cellspacing="5px">
                    <tr>
                        <td colspan="3">
                            <div style="padding: 5px;" class="ui-state-highlight ui-corner-all">
                                <span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
                                @string.Format(Html.Global("Account_Register_PasswordLength"), Html.Encode(ViewData["PasswordLength"]))
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="white-space: nowrap;">
                            <label for="UserName">
                                @Html.Global("RES_USER_NAME"):</label>
                        </td>
                        <td>
                            @{ Ajax.Dna().TextBox("UserName")
                                  .Width(300)
                                  .Value(Model!=null ? Model.UserName : "")
                                  .IconImageUrl(Url.Content("~/content/images/icon_contact_16.gif"))
                                  .HtmlAttributes(Html.GetUnobtrusiveValidationAttributes("UserName"))
                                  .Render();
                            }
                        </td>
                        <td>@Html.ValidationMessageFor(m => m.UserName, "*")
                        </td>
                    </tr>
                    <tr>
                        <td style="white-space: nowrap;">
                            <label for="Email">
                                @Html.Global("RES_EMAIL"):</label>
                        </td>
                        <td>
                            @{Ajax.Dna().TextBox("Email")
                                  .Width(300)
                                  .Value(Model != null ? Model.Email : "")
                                  .HtmlAttributes(Html.GetUnobtrusiveValidationAttributes("Email"))
                                  .IconImageUrl(Url.Content("~/content/images/icon_mail_16.png"))
                                  .Render();
                            }
                        </td>
                        <td>
                            @Html.ValidationMessageFor(m => m.Email, "*")
                        </td>
                    </tr>
                    <tr>
                        <td style="white-space: nowrap;">
                            <label for="password">
                                @Html.Global("RES_PASSWORD"):</label>
                        </td>
                        <td>
                            @{
                              Ajax.Dna().TextBox("Password")
                                  .Password()
                                  .Value(Model != null ? Model.Password : "")
                                  .Width(300)
                                  .HtmlAttributes(Html.GetUnobtrusiveValidationAttributes("Password"))
                                  .IconImageUrl(Url.Content("~/content/images/icon_key_16.gif"))
                                  .Render();
                            }
                        </td>
                        <td>@Html.ValidationMessageFor(m => m.Password, "*")
                        </td>
                    </tr>
                    <tr>
                        <td style="white-space: nowrap;">
                            <label for="ConfirmPassword">
                                @Html.Global("RES_CONFIRM_PASSWORD"):</label>
                        </td>
                        <td>
                            @{
                              Ajax.Dna().TextBox("ConfirmPassword")
                                  .Password()
                                  .Value(Model != null ? Model.ConfirmPassword : "")
                                  .Width(300)
                                  .HtmlAttributes(Html.GetUnobtrusiveValidationAttributes("ConfirmPassword"))
                                  .IconImageUrl(Url.Content("~/content/images/icon_accept_16.png"))
                                  .Render();
                            }
                        </td>
                        <td>@Html.ValidationMessageFor(m => m.ConfirmPassword, "*")
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                        @if (web.MasterTools.EnableReCaptcha)
                        {
                            @ReCaptcha.GetHtml(theme: "clean")
                        }
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" style="text-align: right;">
                            @{
                              Ajax.Dna().Button()
                                  .Text(Html.Global("RES_REGISTER"))
                                  .Options(opts => { opts.IsSubmitButton = true; })
                                  .ImageIcons(Url.Content("~/content/images/icon_add_16.png"))
                                  .Render();
                            }
                        </td>
                    </tr>
                </table>
            </td>
            <td style="vertical-align: top; padding: 8px;">
                @Ajax.Dna().WidgetZone("Right zone", "zone2").HtmlAttributes(new { style = "margin-right: 5px; float: none;" }).GetHtml()
            </td>
        </tr>
    </table>
}
@{Ajax.Dna().WidgetZone("Bottom zone", "zone3").Render();}
